﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AdminUserManager.ascx.cs" Inherits="CMS.Controls.AdminUser.AdminUserManager" %>
<%@ Import Namespace="Core.Library" %>

<asp:PlaceHolder ID="plcControl" runat="server"/>
<!-- / placeholder -->    

<asp:Literal ID="ltMessage" runat="server"/>
<!-- / message -->    

<div class="widget first">
    <div class="head"><h5 class="iFrames">Danh sách thành viên</h5></div>
    <div class="dataTables_wrapper" id="example_wrapper">
        <div class="">
            <div class="dataTables_filter" id="example_filter" style="top: -39px;">
                <label>
                    <asp:DropDownList ID="ddlGroup" AutoPostBack="true" runat="server" 
                                      DataValueField="AdminGroupId" DataTextField="Name" 
                                      OnSelectedIndexChanged="ddlGroup_SelectedIndexChanged"/>
                    <a href="<%= UrlHelpers.CreateUser %>" class="btn14 topDir floatleft ml10" title="Tạo mới thành viên">
                        <img src="/images/icons/dark/add.png" alt=""/>
                    </a>
                </label>
            </div>
        </div>
    </div>
    
    <asp:ListView ID="lvUser" DataKeyNames="AdminUserId" runat="server" OnItemDataBound="lvUser_ItemDataBound" OnItemCommand="lvUser_ItemCommand">
    <LayoutTemplate>
        <table width="100%" cellspacing="0" cellpadding="0" class="tableStatic">
            <thead>
                <tr>
                    <td>STT</td>
                    <td>Tên đăng nhập</td>
                    <td>Hòm thư</td>
                    <td>Họ tên</td>
                    <td>Ngày sinh</td>
                    <td>Giới tính</td>
                    <td>Trạng thái</td>                
                    <td>Thành viên</td>                       
                    <td>Mật khẩu</td>                     
                    <td class="w100">Thao tác</td>
                </tr>
            </thead>
            <tbody>
                <tr id="itemPlaceHolder" runat="server"></tr>
            </tbody>
        </table>
    </LayoutTemplate>
    <ItemTemplate>
        <tr>
            <td class="aligncenter">
                <%# Container.DataItemIndex + 1 %>
                <asp:HiddenField ID="hfAdminUserId" Value='<%# Eval("AdminUserId") %>' runat="server"/>    
                <asp:HiddenField ID="hfStatus" Value='<%# Eval("Status") %>' runat="server"/>    
            </td>
            <td><%# Eval("UserName")%></td>
            <td><%# Eval("Email")%></td>
            <td><%# Eval("FullName")%></td>
            <td class="aligncenter"><%# DateTimeFunctions.FormatIn_DDMMYYYY(ConvertUtility.ToDateTime(Eval("Birthday")))%></td>
            <td class="aligncenter"><%# ConvertUtility.ConvertTo<bool>(Eval("Gender")) ? "Nam" : "Nữ" %></td>
            <td class="aligncenter"><%# GetStatus(ConvertUtility.ConvertTo<int>(Eval("Status"))) %></td>            
            <td class="aligncenter">
                <a href="<%# UrlHelpers.AdminGroupUser(ConvertUtility.ConvertTo<int>(Eval("AdminUserId"))) %>" class="btn14 topDir" title="Phân nhóm cho thành viên">
                    <img src="/images/icons/dark/users.png" alt=""/>
                </a>
            </td>                           
            <td class="aligncenter">
                <asp:HyperLink ID="hlChangePassword" CssClass="btn14 topDir" ToolTip="Đổi mật khẩu" NavigateUrl='<%# UrlHelpers.ChangePassword(ConvertUtility.ConvertTo<int>(Eval("AdminUserId"))) %>' runat="server">
                    <img src="/images/icons/dark/key.png" alt="Đổi mật khẩu"/>
                </asp:HyperLink>                                                                  
            </td>            
            <td class="aligncenter">                
                <asp:HyperLink ID="hlEdit" CssClass="ml5 btn14 topDir" ToolTip="Sửa" CommandName="EditGroup" runat="server">
                    <img src="/images/icons/dark/pencil.png" alt=""/>
                </asp:HyperLink>                         

                <asp:LinkButton runat="server" ID="lnkDelete" ToolTip="Xóa" CssClass="ml5 btn14 topDir" OnClientClick="retun confirm('Bạn có chắc chắn muốn xóa?');" CommandName="DeleteUser">
                    <img src="/images/icons/dark/close.png" alt="Xóa"/>
                </asp:LinkButton>                                                  
            </td>
        </tr>                	
    </ItemTemplate>
    </asp:ListView>    
</div>
<!-- / list user -->    